/**
 * 
 */

package com.xxxx.game;

import java.util.Vector;

/**
 * @author HuXiaolong
 *
 */
public class SpriteVanishAnimation extends FrameAnimation
{
	private int mVanishTimes = 0;
	//private static int max_dying_time = 10;
	// private FadeAnimation mfadeAnimation = null;
	public SpriteVanishAnimation(Vector<Integer> frames, int vanish_times)
	{
		super(frames);
		this.mVanishTimes = this.mFrames.size();
		//this.mfadeAnimation = new FadeAnimation(255,0,this.mFrames.size());
		if (this.mVanishTimes > this.mFrames.size())
			this.mVanishTimes = this.mFrames.size();
	}

	@Override
	public boolean isMoving()
	{
		return false;
	}
	
	@Override
	public boolean update(ISprite sprite)
	{
		if (!super.update(sprite) || mVanishTimes <= 0 || -- mVanishTimes <= 0)
		{
			//Log.i("jewel", "make jewel dead!");
			sprite.makedead();
			return false;
		}
		return true;
	}
	
	@Override
	public String getName()
	{
		return "VanishAnimation";
	}
}
